import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';

import { Observable } from 'rxjs';
import { StudentService } from "../../shared/services/student.service";

@Injectable()
export class StudentResolver implements Resolve<Observable<any>> {

    constructor(private studentService: StudentService){
    }

    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any>| any {
         return this.studentService.getOne(route.params["id"]);
    }
}
